﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate.Mappings;
using Apollo.Core;

namespace Apollo
{
    [NHibernateEntity(Table = "apl_BulkImportProjections")]
    public class BulkImportProjection
    {
        public BulkImportProjection() { }

        [PrimaryKey]
        public virtual int Id { get; set; }

        [BelongsTo(Column = "ID_BulkImport")]
        public virtual BulkImport BulkImport { get; set; }

        [Property]
        public virtual string Name { get; set; }

        [Property]
        public virtual int ColumnNumber { get; set; }

        [Property]
        public virtual string ProjectionPath { get; set; }

        protected Projection projection;

        public virtual Projection Projection { get {
            if (projection == null)
                projection = new Projection(this.ProjectionPath, this.BulkImport.Entity.MappedClass);

            return projection;
        } }

    }
}
